<%@ page import="com.example.jstl.User" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>JSTL</title>
</head>
<body>
<%
    List<User> users = new ArrayList<>();
    User u1 = new User("李白",28);
    users.add(u1);
    User u2 = new User("杜甫",18);
    users.add(u2);
    User u3 = new User("高适",32);
    users.add(u3);
    request.setAttribute("userList",users);
    request.setAttribute("lb",u1);
%>

forEach:
<br/>

<c:forEach items="${userList}" var="user" varStatus="s">
    ${s.index} ${s.count} ${user} <br>
</c:forEach>


</body>
</html>
